#include "mcc_generated_files/mcc.h"
#include "AS5045B.h" 
#include "RS485.h"




void main(void)
{
    SYSTEM_Initialize();
//    INTERRUPT_GlobalInterruptEnable();
//    INTERRUPT_PeripheralInterruptEnable();
    
//    spi_master_open(MASTER1);
    while (1)
    {
//             AS5045_Dat();
            if(S_Flag==1) 
            {
                AS5045_Dat();
                Send485();
                S_Flag=0;
            }


              else if(S_Flag==3)
            {
                WriteZero();
                Send485();
                S_Flag=0;
            }
            else
                rec485();
        
    }
}
